Topological Data Analysis Project

Name: Pragya Shukla

Roll No: MDS202027

Table of Contents

Part 1:

Part 2:

Part 1:

Topology of time series

References

Import libraries

1. From Time Series to Sliding Window Embeddings

The first step in analysing the topology of time series is to construct a so-called sliding window embedding, invented by Takens in the 1980s. As shown in the diagram below, a sliding window embedding of a signal can be thought of as sliding a "window" of fixed size over a signal, with each window represented as a point in a (possibly) higher-dimensional space:

Figure reference: https://bit.ly/3easx09

More formally: given a time series $f(t)$, one can extract a sequence of vectors of the form $f_i = [(f(t_i)), f(t_i + 2 \tau), \ldots, f(t_i + M \tau)] \in \mathbb{R}^{M+1}$, where $M$ is the embedding dimension and $\tau$ is the time delay. The quantity $M\tau$ is known as the "window size" and the difference between $t_{i+1}$ and $t_i$ is called the stride.

The sliding window allows us to apply Takens' embedding locally on a certain interval rather than over the whole time series. The result of this procedure is a time series of point clouds with possibly interesting topologies. These topologies can be used to classify whether a signal is periodic or not.

1.1. A Periodic Example

A function is periodic with period $T > 0$ if $f(t + T) = f(t)$ for all $t \in \mathbb{R}$. For example, consider the function $f(t) = \cos(5 t)$ which can be visualised as follows:

We can show that periodicity implies circularity of the sliding window embedding. To do that we need to specify the embedding dimension $M$ and the time delay $\tau$ for the Takens embedding:

Let's apply this embedding to our time series to get a new time series:

We have gone from a one-dimensional series to a 3-dimensional one, so let's visualise the sliding window embedding as a point cloud:

As promised, the periodicity of $f$ is reflected in the circularity of the sliding window embedding! It turns out that in general, periodic functions trace out ellipses in $\mathbb{R}^{M+1}$.

1.2. A Non-Periodic Example

Here is another type of recurrent behaviour: if we let $f(t) = \cos(t) + \cos(\pi t)$ then it follows that $f$ is not periodic since the ratio of the two frequencies is irrational, i.e. we say that $\cos(t)$ and $\cos(\pi t)$ are incommensurate. Nevertheless, their sum produces recurrent behaviour:

As before, let's create a sliding window embedding for this signal and visualise the resulting point cloud:

1.3. Other Periodic Examples

sin(x)

sin(5x)

sin(x) + cos(x)

1.4. Some other Non-Periodic Functions

xcos(x)

$\mathbb{e}^{0.2x}$ sin(10x)